<template>
  <div class="english">
    <div class="header">
      <!-- <span class="iconfont icon-fanhui"></span> -->
      <router-link to="/Studay"
        ><span class="iconfont icon-fanhui"></span
      ></router-link>
      <h2>{{ title }}</h2>
    </div>
    <div class="con">
      <div class="nav">
        <ul>
          <li v-for="open in openclass" :key="open.id">
            <img :src="open.img" alt="" />
            <p>{{ open.title }}</p>
          </li>
          <!-- <li>
            <img src="../../public/images/y6.jpg" />
            <p>实用英语</p>
          </li>
          <li>
            <img src="../../public/images/y4.jpg" />
            <p>实用英语</p>
          </li>
          <li>
            <img src="../../public/images/4.jpg" />
            <p>实用英语</p>
          </li>
          <li>
            <img src="../../public/images/4.jpg" />
            <p>实用英语</p>
          </li>
          <li>
            <img src="../../public/images/4.jpg" />
            <p>实用英语</p>
          </li>
          <li>
            <img src="../../public/images/4.jpg" />
            <p>实用英语</p>
          </li> -->
        </ul>
      </div>
      <div class="xian"></div>
      <div class="biao"><img src="../../public/images/day.jpg" alt="" /></div>
      <div class="option">
        <div class="bottom">
          <ul>
            <li v-for="goodcla in goodclass" :key="goodcla.id">
              <div class="li1">
                <span>{{ goodcla.biaoqian }}</span>
                <h3>单{{ goodcla.title }}</h3>
              </div>
              <div class="li2">
                开课时间：
                <p>{{ goodcla.time }}</p>
                <i>{{ goodcla.classtime }}</i
                >课时
              </div>
              <div class="li3">
                <div class="zuo">
                  <img :src="goodcla.img" alt="" />
                  <p>{{ goodcla.teacher }}</p>
                </div>
                <div class="you">
                  <p>免费</p>
                  <span
                    >已有<i>{{ goodcla.num }}人报名</i></span
                  >
                </div>
              </div>
            </li>
            <!-- <li>
              <div class="li1">
                <span>实用英语</span>
                <h3>单词速递挑战营</h3>
              </div>
              <div class="li2">
                开课时间：
                <p>2020-01-03 20:00:00</p>
                <i>3</i>课时
              </div>
              <div class="li3">
                <div class="zuo">
                  <img src="../../public/images/pp.jpg" alt="" />
                  <p>杨亮</p>
                </div>
                <div class="you">
                  <p>免费</p>
                  <span>已有<i>1222人报名</i></span>
                </div>
              </div>
            </li> -->
          </ul>
        </div>
      </div>
    </div>
  </div>
</template>
<script>
import axios from "axios";
export default {
  name: "english",
  data() {
    return {
      title: "",
      goodclass: [],
      openclass: [],
    };
  },
  methods: {
    to() {
      this.$router.push("/Studay");
    },
  },
  created() {
    console.log(111);
    console.log(this.$route.params.id);
    axios({
      url: " http://localhost:3000/gongnengs/" + this.$route.params.id,
      method: "get",
      params: {},
    }).then((res) => {
      //res.data直接就是后端返回来的数据，并且是json数据
      console.log(333);
      console.log(res.data);
      this.title = res.data.title;
      //   console.log(this.title);
    }),
      axios({
        url: "http://localhost:3000/goodclass",
        method: "get",
        params: {},
      }).then((res) => {
        //res.data直接就是后端返回来的数据，并且是json数据
        this.goodclass = res.data;
      }),
      axios({
        url: "http://localhost:3000/openclass",
        method: "get",
        params: {},
      }).then((res) => {
        this.openclass = res.data;
      });
  },
};
</script>

<style scoped>
@import url(../assets/iconfont.css);
/* @import url(../assets/font/iconfont.css);s */

.english {
  width: 100%;
}
.header {
  width: 100%;
  height: 60px;
  display: flex;
  align-items: center;
  color: #000;
  font-size: 18px;
  position: fixed;
  top: 0;
  left: 0;
  background-color: #fff;
}
.header span {
  margin-left: 0.15rem;
  font-size: 0.25rem;
}
.header h2 {
  width: 68%;
  text-align: center;
  font-weight: 700;
  font-size: 0.2rem;
}
.con {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.con .nav {
  width: 100%;
  height: 1rem;
  margin-top: 0.6rem;
}
.con .nav ul {
  height: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: nowrap;
  overflow-x: auto;
}
.con .nav ul li {
  width: 23%;
  display: flex;
  flex-direction: column;
  align-items: center;
  flex-shrink: 0;
}
.con .nav ul li p {
  font-size: 0.12rem;
  margin-top: 0.2rem;
}
.con .nav ul li img {
  width: 0.4rem;
  height: 0.4rem;
}
.con .xian {
  width: 100%;
  height: 0.08rem;
  background-color: #fcfcfc;
  margin-top: 0.08rem;
}
.con .biao {
  width: 95%;
  margin-top: 0.2rem;
  margin-bottom: 0.25rem;
}
.con .biao img {
  width: 100%;
  height: 0.7rem;
}
.option {
  width: 90%;
}
.option .top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 0.5rem;
}
.option .top h2 {
  font-weight: 700;
}
.option .bottom {
  display: flex;
  margin-bottom: 0.2rem;
  /* width: 100%; */
}
.option .bottom .li1 {
  display: flex;
}
.option .bottom .li1 span {
  background-color: #818894;
  color: #fff;
  border-radius: 0.05rem;
  padding: 0.05rem;
  font-size: 0.12rem;
}
.option .bottom .li1 h3 {
  margin-left: 0.15rem;
  font-weight: 700;
}
.option .bottom .li2 {
  display: flex;
  align-items: center;
  color: #9b9999;
  height: 0.14rem;
  font-size: 0.14rem;
  margin: 0.1rem 0rem;
}
.option .bottom .li2 i {
  margin-left: 0.2rem;
}
.option li {
  margin-bottom: 0.2rem;
}
.option .bottom {
  /* width: 100%; */
  margin-left: 0.1rem;
}
.option .bottom .li3 {
  display: flex;
  width: 100%;
  height: 0.7rem;
  justify-content: space-between;
  border-bottom: 0.01rem solid #9b9999;
}
.option .bottom .li3 .zuo {
  margin-right: 1.8rem;
}
.option .bottom .li3 .zuo img {
  width: 0.3rem;
  height: 0.3rem;
}
.option .bottom .li3 .zuo p {
  font-size: 0.1rem;
  color: #9b9999;
}
.option .bottom .li3 .you p {
  color: red;
  font-weight: 700;
  margin-left: 0.7rem;
}
.option .bottom .li3 .you span {
  color: #9b9999;
  font-size: 0.14rem;
}
.icon-fanhui:before {
  content: "\e672";
  font-size: 0.25rem;
  color: #000;
  margin-right: 0.15rem;
  margin-left: 0.1rem;
}
</style>